//
//  HotspotdebateSYViewController.m
//  Gxj
//
//  Created by 💋索少杰 on 2017/10/17.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "HotspotdebateSYViewController.h"
#import "HotspotdebateSYTableViewCell.h"

@interface HotspotdebateSYViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, strong) UITableView * tableView;

@end

@implementation HotspotdebateSYViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationController.navigationBar.translucent = YES;
    
    self.title=@"热门辩论";
    //导航条内容颜色
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    //系统时间信号颜色
    //self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:17]};
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"bg"]forBarMetrics:UIBarMetricsDefault];
    //导航条左边按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fanhui1"] style:UIBarButtonItemStyleDone target:self action:@selector(clickLeftBarButton)];
    //导航条右边按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"fenlei"] style:UIBarButtonItemStyleDone target:self action:@selector(clickRightButton)];
    
    [self.view addSubview:self.tableView];//添加到视图
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;// 去掉所有cell的分割线
}
//导航条返回按钮响应
- (void)clickLeftBarButton
{
    [self.navigationController popViewControllerAnimated:YES];
}
//导航条右边按钮响应
- (void)clickRightButton
{
    
}
//返回每个分区下的单元格个数，必须实现
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return kHeightScale(205);
}
/*设置标题尾的宽度*/
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return kHeightScale(0);
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString * str= @"biao";
    HotspotdebateSYTableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:str];
    if (!cell) {
        
        cell=[[HotspotdebateSYTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:str];
        
    }
    cell.selectionStyle=UITableViewStylePlain;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.navigationController pushViewController:[ParticularsViewController new] animated:YES];
}

- (UITableView *)tableView
{
    if (!_tableView)
    {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kHeightScale(66), UIScreenWidth, UIScreenHeight-66) style:UITableViewStylePlain];
        
        _tableView.delegate = self;
        
        _tableView.dataSource = self;
    }
    return _tableView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
